let num = 0
function addNum(){
    num++
    console.log(num);
    if(num===10) return
    addNum()
}

const wyd = {
    uname:'wyd',
    age:'18',
    hobby:{
        sports:'basketball',
    address:['湘湖庄园']

    },
    address:['萧山庄园','西湖庄园'],
    sing(){
        console.log('起风了');
    }
}
const dzz = {}
//递归 深拷贝
function deepCopy(newData,oldData){
    for (const k in oldData) {
    if (oldData[k] instanceof Array) {
        newData[k] = []
        deepCopy(newData[k],oldData[k])
    }else if(oldData[k] instanceof Object){
        newData[k] = {}
        deepCopy(newData[k],oldData[k])
    }else if(oldData[k] instanceof Function){
        newData[k] = function(){}
        deepCopy(newData[k],oldData[k])
        }
        else {
        newData[k] =oldData[k]
    }
}
}r
deepCopy(dzz,wyd)
dzz.hobby.address = ['诸暨庄园']
dzz.sing = function(){
    console.log('下雨了');
}
// console.log(dzz);
console.log(wyd);
wyd.sing()